{% extends "base.html" %}
{% block head %}
    <script type="text/javascript" src="../static/js/echarts.js"></script>
    <script type="text/javascript" src="../static/js/echarts.min.js"></script>
    <script type="text/javascript" src="../static/js/china.js"></script>
    	        <meta charset="UTF-8">
        <title>测试管理系统</title>
        <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
        <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
        <link rel="stylesheet" href="../static/layui/css/layui.css">
        <script src="../static/layui/layui.js"></script>
        <!--     <script type="text/javascript">try { Typekit.load(); } catch (e) { }</script> -->
        <script type="text/javascript" src="../static/js/tool_p.js"></script>
{% endblock head %}
{% block left %}
	{{ super() }}
{% endblock left %}
{% block right %}
	{{ super() }}
	<!-- 修改name（页面名称） -->
	{% set name = 'bug统计' %}
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		<legend>{{name}}</legend>
	</fieldset>

<blockquote class="layui-elem-quote" style="font-size: 18px;color: forestgreen;font-weight: bold">当前活跃的版本：{{ data[0] }}</blockquote>
<div class="layui-tab layui-tab-card">
    <ul class="layui-tab-title">
        <li class="layui-this">概括</li>
        <li>bug走势</li>
        <li>处理人统计</li>
        <li>报告人统计</li>
        <li>bug状态统计</li>
        <li>处理类型统计</li>
        <li>严重程度统计</li>
        <li>类别统计</li>
    </ul>
    <div class="layui-tab-content" style="height: 630px;">
        <div class="layui-tab-item layui-show">
<div>
                <div style="display:inline-block;">
        <span id="pro7" class="layui-btn layui-btn-normal" onclick="pro_bug7(this)">近7天项目bug数</span>
    </div>
                <div style="display:inline-block;">
        <span id="pro30" class="layui-btn layui-btn-normal" onclick="pro_bug30(this)">近30天项目bug数</span>
    </div>
</div>
            <div id="prover7" style="display: block;width: 1600px;height:600px;float:left"></div>
            <div id="prover30" style="display: none;width: 1600px;height:600px;float:left"></div>
        </div>
        <div class="layui-tab-item">
            <div id="trend" style="display: block;width: 1024px;height:600px;float:left"></div>
        </div>
        <div class="layui-tab-item">
            <div id="handler" style="display: block;width: 1600px;height:600px;float:left"></div>
        </div>
        <div class="layui-tab-item">
            <div id="reporter" style="width: 800px;height:600px;float:left"></div>
        </div>
        <div class="layui-tab-item">
            <div id="status" style="width: 800px;height:600px;float:left"></div>
        </div>
        <div class="layui-tab-item">
            <div id="resolution" style="width: 800px;height:600px;float:left"></div>
        </div>
        <div class="layui-tab-item">
            <div id="severity" style="width: 800px;height:600px;float:left"></div>
        </div>
        <div class="layui-tab-item">
            <div id="category" style="width: 800px;height:600px;float:left"></div>
        </div>
    </div>
</div>
    <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例prover
        var myCharprover7 = echarts.init(document.getElementById('prover7'));
        var myCharprover30 = echarts.init(document.getElementById('prover30'));
        var myChartrend = echarts.init(document.getElementById('trend'));
        var myCharhandler = echarts.init(document.getElementById('handler'));
        var myCharreporter = echarts.init(document.getElementById('reporter'));
        var myCharstatus = echarts.init(document.getElementById('status'));
        var myCharresolution = echarts.init(document.getElementById('resolution'));
        var myCharseverity = echarts.init(document.getElementById('severity'));
        var myCharcategory = echarts.init(document.getElementById('category'));
        {#var myCharcity = echarts.init(document.getElementById('city'));#}

        // 指定图表的配置项和数据
        var optionprover7 = {
                color: ['#3398DB'],
                title: {
        text: ''
    },
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: '0%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                yAxis : [
                    {
                        type : 'category',
                        data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                           interval:0,
                           rotate:0  //倾斜度数
                        },

                    }
                ],
                xAxis : [
                    {
                        type : 'value'
                    }
                ],
                series : [
                    {
                        name:'bug数',
                        type:'bar',
                        barWidth: '60%',
                        data:[10, 52, 200, 334, 390, 330, 220],
                        	itemStyle: {
                                normal: {
                                    label: {
                                        show: true, //开启显示
                                        position: 'right', //在上方显示
                                        textStyle: { //数值样式
                                            color: 'black',
                                            fontSize: 16
                                        }
                                    }
                                }
                            }
                    }
                ]
            };
        var optionprover30 = {
                color: ['#3398DB'],
                title: {
        text: ''
    },
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: '0%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                yAxis : [
                    {
                        type : 'category',
                        data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                            interval: 0,
                            rotate: 0    //倾斜度数
                        }
                    }
                ],
                xAxis : [
                    {
                        type : 'value'
                    }
                ],
                series : [
                    {
                        name:'bug数',
                        type:'bar',
                        barWidth: '60%',
                        data:[10, 52, 200, 334, 390, 330, 220],
                        	itemStyle: {
                                normal: {
                                    label: {
                                        show: true, //开启显示
                                        position: 'right', //在上方显示
                                        textStyle: { //数值样式
                                            color: 'black',
                                            fontSize: 16
                                        }
                                    }
                                }
                            }
                    }
                ]
            };
        var optiontrend = {
            title: {
                text: '本周新增bug走势(总数：{{ data[1] }})'
            },
            tooltip : {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    label: {
                        backgroundColor: '#6a7985'
                    }
                }
            },
            legend: {
                data:['新增bug数','联盟广告','视频广告','直接访问','搜索引擎']
            },
            toolbox: {
                feature: {
                    saveAsImage: {show:false,}
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis : [
                {
                    type : 'category',
                    boundaryGap : false,
                    data : ['周一','周二','周三','周四','周五','周六','周日']
                }
            ],
            yAxis : [
                {
                    type : 'value'
                }
            ],
            series : [
                {
                    name:'bug数',
                    type:'line',
                    stack: '总量',
                    areaStyle: {},
                    data:[120, 132, 101, 134, 90, 230, 210]
                },
                {#{#}
                {#    name:'联盟广告',#}
                {#    type:'line',#}
                {#    stack: '总量',#}
                {#    areaStyle: {},#}
                {#    data:[220, 182, 191, 234, 290, 330, 310]#}
                {#},#}
                {#{#}
                {#    name:'视频广告',#}
                {#    type:'line',#}
                {#    stack: '总量',#}
                {#    areaStyle: {},#}
                {#    data:[150, 232, 201, 154, 190, 330, 410]#}
                {#},#}
                {#{#}
                {#    name:'直接访问',#}
                {#    type:'line',#}
                {#    stack: '总量',#}
                {#    areaStyle: {normal: {}},#}
                {#    data:[320, 332, 301, 334, 390, 330, 320]#}
                {#},#}
                {#{#}
                {#    name:'搜索引擎',#}
                {#    type:'line',#}
                {#    stack: '总量',#}
                {#    label: {#}
                {#        normal: {#}
                {#            show: true,#}
                {#            position: 'top'#}
                {#        }#}
                {#    },#}
                {#    areaStyle: {normal: {}},#}
                {#    data:[820, 932, 901, 934, 1290, 1330, 1320]#}
                {#}#}
            ]
        };

        var optionhandler = {
                color: ['#3398DB'],
                title: {
        text: '按处理人统计bug数'
    },
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: '0%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis : [
                    {
                        type : 'category',
                        data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                           interval:0,
                           rotate:50
                        },
                    }
                ],

                yAxis : [
                    {
                        type : 'value'
                    }
                ],
                series : [
                    {
                        name:'bug数',
                        type:'bar',
                        barWidth: '60%',
                        data:[10, 52, 200, 334, 390, 330, 220],
                        itemStyle: {
                                normal: {
                                    label: {
                                        show: true, //开启显示
                                        position: 'top', //在上方显示
                                        textStyle: { //数值样式
                                            color: 'black',
                                            fontSize: 16
                                        }
                                    }
                                }
                            }
                    }
                ]
            };
        var optionreporter = {
                color: ['#3398DB'],
            title: {
        text: '按报告人统计bug数'
    },
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: '0%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis : [
                    {
                        type : 'category',
                        data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                        axisTick: {
                            alignWithLabel: true
                        }
                    }
                ],
                yAxis : [
                    {
                        type : 'value'
                    }
                ],
                series : [
                    {
                        name:'bug数',
                        type:'bar',
                        barWidth: '60%',
                        data:[10, 52, 200, 334, 390, 330, 220],
                        itemStyle: {
                                normal: {
                                    label: {
                                        show: true, //开启显示
                                        position: 'top', //在上方显示
                                        textStyle: { //数值样式
                                            color: 'black',
                                            fontSize: 16
                                        }
                                    }
                                }
                            }
                    }
                ]
            };
        var optionstatus = {
                color: ['#3398DB'],
            title: {
        text: '按状态统计bug数'
    },
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: '0%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis : [
                    {
                        type : 'category',
                        data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                        axisTick: {
                            alignWithLabel: true
                        }
                    }
                ],
                yAxis : [
                    {
                        type : 'value'
                    }
                ],
                series : [
                    {
                        name:'bug数',
                        type:'bar',
                        barWidth: '60%',
                        data:[10, 52, 200, 334, 390, 330, 220],
                        itemStyle: {
                                normal: {
                                    label: {
                                        show: true, //开启显示
                                        position: 'top', //在上方显示
                                        textStyle: { //数值样式
                                            color: 'black',
                                            fontSize: 16
                                        }
                                    }
                                }
                            }
                    }
                ]
            };
        var optionresolution = {
                color: ['#3398DB'],
            title: {
        text: '按类型统计bug数'
    },
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: '0%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis : [
                    {
                        type : 'category',
                        data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                        axisTick: {
                            alignWithLabel: true
                        }
                    }
                ],
                yAxis : [
                    {
                        type : 'value'
                    }
                ],
                series : [
                    {
                        name:'bug数',
                        type:'bar',
                        barWidth: '60%',
                        data:[10, 52, 200, 334, 390, 330, 220],
                        itemStyle: {
                                normal: {
                                    label: {
                                        show: true, //开启显示
                                        position: 'top', //在上方显示
                                        textStyle: { //数值样式
                                            color: 'black',
                                            fontSize: 16
                                        }
                                    }
                                }
                            }
                    }
                ]
            };
        var optionseverity = {
                color: ['#3398DB'],
            title: {
        text: '按严重程度统计bug数'
    },
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: '0%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis : [
                    {
                        type : 'category',
                        data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                        axisTick: {
                            alignWithLabel: true
                        }
                    }
                ],
                yAxis : [
                    {
                        type : 'value'
                    }
                ],
                series : [
                    {
                        name:'bug数',
                        type:'bar',
                        barWidth: '60%',
                        data:[10, 52, 200, 334, 390, 330, 220],
                        itemStyle: {
                                normal: {
                                    label: {
                                        show: true, //开启显示
                                        position: 'top', //在上方显示
                                        textStyle: { //数值样式
                                            color: 'black',
                                            fontSize: 16
                                        }
                                    }
                                }
                            }
                    }
                ]
            };
        var optioncategory = {
                color: ['#3398DB'],
            title: {
        text: '按类别统计bug数'
    },
                tooltip : {
                    trigger: 'axis',
                    axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                        type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                grid: {
                    left: '0%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis : [
                    {
                        type : 'category',
                        data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                        axisTick: {
                            alignWithLabel: true
                        }
                    }
                ],
                yAxis : [
                    {
                        type : 'value'
                    }
                ],
                series : [
                    {
                        name:'bug数',
                        type:'bar',
                        barWidth: '60%',
                        data:[10, 52, 200, 334, 390, 330, 220],
                        itemStyle: {
                                normal: {
                                    label: {
                                        show: true, //开启显示
                                        position: 'top', //在上方显示
                                        textStyle: { //数值样式
                                            color: 'black',
                                            fontSize: 16
                                        }
                                    }
                                }
                            }
                    }
                ]
            };


                window.onload=function () {
            var xmlhttp;
            xmlhttp = new XMLHttpRequest();
            {#var data ='{  "url_id" :' + url_id + '}';#}
            xmlhttp.open("POST","statistical_details",true);
            xmlhttp.send();
            xmlhttp.onreadystatechange = function()
        {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200 )
            {
            var c = JSON.parse(xmlhttp.responseText)
                {#alert(c.code)#}
                if (c.code == 1000){

                    optionprover7.yAxis[0].data= Object.keys(c['prover7'])
                    optionprover7.series[0].data=Object.values(c['prover7'])
                    myCharprover7.setOption(optionprover7);

                    optionprover30.yAxis[0].data= Object.keys(c['prover30'])
                    optionprover30.series[0].data=Object.values(c['prover30'])
                    myCharprover30.setOption(optionprover30);

                    optiontrend.xAxis[0].data= Object.keys(c['trend'])
                    optiontrend.series[0].data=Object.values(c['trend'])
                    myChartrend.setOption(optiontrend);

                    optionhandler.xAxis[0].data= Object.keys(c['handler'])
                    optionhandler.series[0].data=Object.values(c['handler'])
                    myCharhandler.setOption(optionhandler);

                    optionreporter.xAxis[0].data= Object.keys(c['reporter'])
                    optionreporter.series[0].data=Object.values(c['reporter'])
                    myCharreporter.setOption(optionreporter);

                    optionstatus.xAxis[0].data= Object.keys(c['status'])
                    optionstatus.series[0].data=Object.values(c['status'])
                    myCharstatus.setOption(optionstatus);

                    optionresolution.xAxis[0].data= Object.keys(c['resolution'])
                    optionresolution.series[0].data=Object.values(c['resolution'])
                    myCharresolution.setOption(optionresolution);

                    optionseverity.xAxis[0].data= Object.keys(c['severity'])
                    optionseverity.series[0].data=Object.values(c['severity'])
                    myCharseverity.setOption(optionseverity);

                    optioncategory.xAxis[0].data= Object.keys(c['category'])
                    optioncategory.series[0].data=Object.values(c['category'])
                    myCharcategory.setOption(optioncategory);
                }

            }
        }
        }

        </script>

{% endblock right %}
<!-- 此模板现有部分，除页面名称外，其他均不可编辑 -->